<template>
  <div class="news-list bg-c-fff pb70">
    <div class="news-banner rel">
      <div class="abs ban-news">
        <div class="container">
          <!-- <a href="">早报：P2P用银行卡突破限额 众安保险赴港上市</a> -->
        </div>
      </div>
    </div>
    <div class="fix container pt30">
      <div class="flo-left news-list-left">
        <ul>
          <li class="fix cup" v-for="item in newList" @click="onNewDetail(item.id)">
            <img :src="item.image" alt="" class="flo-left">
            <div class="flo-right">
              <h2>{{item.title}}</h2>
              <p class="text-ovh">{{item.roundup}}</p>
              <div class="time-box">
                <div class="dib">
                  <i class="iconfont icon-yanjing vs"></i>
                  <span>阅读：22</span>
                </div>
                <div class="dib">
                  <i class="iconfont icon-shijian1 vm"></i>
                  <span>时间：{{item.createTime}}</span>
                </div>
              </div>
            </div>
          </li>
        </ul>
        <button class="more tc db" @click="more">{{moreText}}</button>
      </div>
      <div class="flo-right news-list-right">
        <form action="">
          <input type="text">
          <input type="button" value="搜索">
        </form>
        <right-list></right-list>
      </div>
    </div>
  </div>
</template>
<script type="text/javascript">
import RightList from '../components/RightList'
export default {
  components: {
    RightList
  },
  data() {
    return {
      newList: [],
      page: 1,
      moreText: '加载更多'
    }
  },
  mounted() {
    this.getNewData()
  },
  methods: {
    getNewData() {
      var parms = {
        page: this.page,
        rows: 2,
        type: 1
      }
      this.$http.get('/sysContent/list', {
        params: parms
      }).then(data => {
        if (data.data.httpCode === 200) {
          if (data.data.rows.length > 0) {
            data.data.rows.forEach((i) => {
              this.newList.push(i)
            })
          } else {
            this.moreText = '没有更多了'
          }
        } else {
          console.log(data.data.msg)
          this.$toasted.show(data.data.msg)
        }
      }).catch(err => {
        console.log(err)
      })
    },
    more() {
      this.page += 1
      this.getNewData()
    },
    onNewDetail(id) {
      this.$router.push('/news-text?id=' + id)
    }
  }
}

</script>
<style type="text/css" scoped>
.news-banner {
  width: 100%;
  height: 300px;
  background: url(../assets/about-banner.jpg) no-repeat center;
  background-size: cover;
}

.ban-news {
  background: rgba(0, 0, 0, 0.5);
  bottom: 0;
  line-height: 50px;
  font-size: 20px;
  font-weight: bold;
  width: 100%;
  min-width: 1200px;
}

.ban-news a {
  color: #fff;
}

.pt30 {
  padding-top: 30px;
}

.news-list-left {
  width: 850px;
}

.news-list-left li {
  padding: 34px 20px;
  border-bottom: 1px solid #ddd;
}

.news-list-left li:last-child {
  border: none;
}

.news-list-left li img {
  width: 220px;
  height: 120px;
}

.news-list-left li .flo-right {
  width: 573px;
}

.news-list-left li .flo-right h2 {
  padding-bottom: 12px;
  font-size: 20px;
}

.news-list-left li .flo-right p {
  line-height: 40px;
  color: #747474;
  height: 40px;
}

.news-list-left li:hover h2 {
  color: #01378c;
}

.time-box {
  color: #909090;
  margin-top: 22px;
  font-size: 12px;
}

.time-box .dib {
  margin-right: 15px;
}

.time-box .dib .icon-yanjing {
  font-size: 22px;
}

.more {
  width: 850px;
  height: 60px;
  line-height: 60px;
  background-color: #f5f5f5;
  border: 1px solid #e5e6e7;
  margin-top: 15px;
  color: #404040;
  font-size: 16px;
}

.news-list-right {
  width: 300px;
  padding: 20px;
  margin-top: 20px;
  background-color: #f5f5f5;
}

.news-list-right input {
  height: 30px;
  line-height: 30px;
  vertical-align: middle;
}

.news-list-right input[type='text'] {
  width: 200px;
  border: 1px solid #e5e6e7;
  margin-right: 6px;
  padding: 0 5px;
}

.news-list-right input[type='button'] {
  width: 50px;
  background-color: #fff;
  border: 1px solid #e60012;
}

</style>
